#!/bin/sh

set -e

# Undo diversions by old (potato) lynx-ssl package
if [ "$1" = upgrade -o "$1" = install ]; then
  if dpkg-divert --list | grep -q "/usr/bin/lynx.nossl.*lynx-ssl"; then
        dpkg-divert --package lynx-ssl --remove --rename \
        --divert /usr/bin/lynx.nossl /usr/bin/lynx
  fi
  if dpkg-divert --list | grep -q "/usr/share/man/man1/lynx.nossl.1.gz.*lynx-ssl"; then
    dpkg-divert --package lynx-ssl --remove --rename \
        --divert /usr/share/man/man1/lynx.nossl.1.gz /usr/share/man/man1/lynx.1.gz
  fi
fi
